import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { JqtXcxInfoVO, JqtXcxInfoForm, JqtXcxInfoQuery } from '@/api/bus/jqtXcxInfo/types';

/**
 * 查询小程序信息列表
 * @param query
 * @returns {*}
 */

export const listJqtXcxInfo = (query?: JqtXcxInfoQuery): AxiosPromise<JqtXcxInfoVO[]> => {
  return request({
    url: '/bus/jqtXcxInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询小程序信息详细
 * @param id
 */
export const getJqtXcxInfo = (id: string | number): AxiosPromise<JqtXcxInfoVO> => {
  return request({
    url: '/bus/jqtXcxInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增小程序信息
 * @param data
 */
export const addJqtXcxInfo = (data: JqtXcxInfoForm) => {
  return request({
    url: '/bus/jqtXcxInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改小程序信息
 * @param data
 */
export const updateJqtXcxInfo = (data: JqtXcxInfoForm) => {
  return request({
    url: '/bus/jqtXcxInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除小程序信息
 * @param id
 */
export const delJqtXcxInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/bus/jqtXcxInfo/' + id,
    method: 'delete'
  });
};
/**
 * 查询我的小程序信息列表
 * @param query
 * @returns {*}
 */

export const getMyXcxInfo = (query?: JqtXcxInfoQuery): AxiosPromise<JqtXcxInfoVO[]> => {
  return request({
    url: '/bus/jqtXcxInfo/getMyXcxInfo',
    method: 'get',
    params: query
  });
};


export interface UserQuotaResp {
  promotionLinkCount: number;
  customerAssistantCount: number;
  wechatWorkCount: number;
  miniProgramCount: number;
  wechatAccountCount: number;
}

export const getUserXcxQuota = (): AxiosPromise<UserQuotaResp> => {
  return request({
    url: '/bus/jqtXcxInfo/getUserXcxQuota',
    method: 'get'
  });
};
